var e = require;
var t = module;
var o = exports;
var ii, nn = this && this.__extends || (ii = function (t, e) {
    return (ii = Object.setPrototypeOf || {
        __proto__: []
    }
        instanceof Array &&
        function (t, e) {
            t.__proto__ = e
        } ||
        function (t, e) {
            for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
        })(t, e)
},
    function (t, e) {
        function o() {
            this.constructor = t
        }
        ii(t, e),
            t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
    }
),
    rr = this && this.__awaiter ||
        function (t, e, o, i) {
            return new (o || (o = Promise))(function (n, a) {
                function r(t) {
                    try {
                        l(i.next(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function s(t) {
                    try {
                        l(i.
                            throw(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function l(t) {
                    var e;
                    t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
                        t(e)
                    })).then(r, s)
                }
                l((i = i.apply(t, e || [])).next())
            })
        };
var oo = (this && this.__decorate) ||
    function (e, t, a, n) {
        var i,
            o = arguments.length,
            s = o < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, a)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);
        else
            for (var r = e.length - 1; r >= 0; r--)
                (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
        return o > 3 && s && Object.defineProperty(t, a, s), s;
    }; Object.defineProperty(o, "__esModule", { value: !0 });
var a = e("LoadRes"),
    n = e("sdkConfig"),
    i = e("AdFactory"),
    r = (function () {
        function e() {
            (this.adFactory = null), (this.adConfig = null), (this.adFactory = i.default.produceAD());
        }
        return (
            (e.getInstance = function () {
                return e.instance || (e.instance = new e()), e.instance;
            }),
            (e.prototype.startLoadAd = function () {
                null != this.adConfig &&
                    (this.adConfig.main_switch ? this.setAllAdConfig() : console.log("广告总开关未开启"));
            }),
            (e.prototype.setAllAdConfig = function () {
                var e = this;
                void 0 !== this.adConfig.ad_id_info &&
                    null != this.adConfig.ad_id_info &&
                    this.adConfig.ad_id_info &&
                    ((this.adFactory.ID_Video = this.adConfig.ad_id_info.video_id),
                        (this.adFactory.ID_Video_Share = this.adConfig.ad_id_info.video_shard_id),
                        (this.adFactory.ID_System_Banner = this.adConfig.ad_id_info.banner_id),
                        (this.adFactory.ID_System_Inters = this.adConfig.ad_id_info.inters_id),
                        (this.adFactory.ID_Custom_Banner = this.adConfig.ad_id_info.custom_banner_id),
                        (this.adFactory.ID_Custom_Inters = this.adConfig.ad_id_info.custom_inters_id),
                        (this.adFactory.ID_Native_Banner = this.adConfig.ad_id_info.native_banner_id),
                        (this.adFactory.ID_Native_Inters = this.adConfig.ad_id_info.native_inters_id),
                        (this.adFactory.ID_Native_Icon = this.adConfig.ad_id_info.native_icon_id),
                        (this.adFactory.ID_Native_Image = this.adConfig.ad_id_info.native_image_id),
                        (this.adFactory.ID_Box_Banner = this.adConfig.ad_id_info.box_banner_id),
                        (this.adFactory.ID_Box_View = this.adConfig.ad_id_info.box_view_id)),
                    void 0 !== this.adConfig.game_test_id &&
                    null != this.adConfig.game_test_id &&
                    0 != this.adConfig.game_test_id &&
                    this.adFactory.GameVersion(this.adConfig.game_test_id);
                var t = this.adFactory.getGameTestVersion(),
                    o = null,
                    i = null,
                    r = null,
                    s = null,
                    l = null;
                t &&
                    void 0 !== this.adConfig.test_ad_switch &&
                    null != this.adConfig.test_ad_switch &&
                    this.adConfig.test_ad_switch
                    ? ((o = this.adConfig.test_ad_switch),
                        (i = this.adConfig.test_video_switch),
                        (r = this.adConfig.test_banner_switch),
                        (s = this.adConfig.test_inter_switch),
                        (l = this.adConfig.test_native_switch))
                    : void 0 !== this.adConfig.ad_switch &&
                    null != this.adConfig.ad_switch &&
                    this.adConfig.ad_switch &&
                    ((o = this.adConfig.ad_switch),
                        (i = this.adConfig.video_switch),
                        (r = this.adConfig.banner_switch),
                        (s = this.adConfig.inter_switch),
                        (l = this.adConfig.native_switch)),
                    void 0 !== o &&
                    null != o &&
                    o &&
                    ((this.adFactory.SW_Ad_Main = o.ad_main_switch),
                        (this.adFactory.SW_Video = o.video_switch),
                        (this.adFactory.SW_System_Banner = o.banner_switch),
                        (this.adFactory.SW_System_Inters = o.inters_switch),
                        (this.adFactory.SW_Custom_Banner = o.custom_banner_switch),
                        (this.adFactory.SW_Custom_Inters = o.custom_inters_switch),
                        (this.adFactory.SW_Native_Banner = o.native_banner_switch),
                        (this.adFactory.SW_Native_Inters = o.native_inters_switch),
                        (this.adFactory.SW_Native_Icon = o.native_icon_switch),
                        (this.adFactory.SW_Native_Image = o.native_image_switch),
                        (this.adFactory.SW_Box_Banner = o.box_banner_switch),
                        (this.adFactory.SW_Box_View = o.box_view_switch)),
                    void 0 !== i &&
                    null != i &&
                    i &&
                    ((this.adFactory.Control_Video = i.video_switch),
                        (this.adFactory.Control_Inters_To_Video_Switch = i.inters_to_video_switch),
                        (this.adFactory.Control_Inters_To_Video = i.inters_to_video_num),
                        (this.adFactory.Control_Start_Inters_To_Video = i.start_inters_to_video)),
                    void 0 !== r &&
                    null != r &&
                    r &&
                    ((this.adFactory.Control_Banner = r.banner_switch),
                        (this.adFactory.Control_First_Native = r.native_banner_switch),
                        (this.adFactory.Control_Banner_By_Turns = r.banner_by_turns_switch),
                        (this.adFactory.Control_Banner_By_Turns_Num = r.banner_by_turns_num),
                        (this.adFactory.Control_Banner_Update = r.banner_update_time)),
                    void 0 !== s &&
                    null != s &&
                    s &&
                    ((this.adFactory.Control_Inters = s.inters_switch),
                        (this.adFactory.Control_Inters_By_Turns = s.inters_by_turns_switch),
                        (this.adFactory.Control_Inter_By_Sort = s.inters_by_turns_sort),
                        (this.adFactory.Control_Inters_By_Turns_Num = s.inters_by_turns_num),
                        (this.adFactory.Control_Start_Num = s.inters_start_num),
                        (this.adFactory.Control_Interval_Num = s.inters_interval_num),
                        (this.adFactory.Control_Interval_Time = s.inters_interval_time),
                        (this.adFactory.Control_Delay_Time = s.inters_delay_time),
                        (this.adFactory.Control_Delay_Prob = s.inters_delay_prob)),
                    void 0 !== l &&
                    null != l &&
                    l &&
                    ((this.adFactory.Control_Native = l.native_switch),
                        (this.adFactory.Control_Native_Update = l.native_update_time),
                        (this.adFactory.Control_Native_Interval = l.native_interval_switch),
                        (this.adFactory.Control_Native_Interval_Num = l.native_interval_num));
                var _ = this.adConfig.desk_switch;
                void 0 !== _ &&
                    null != _ &&
                    ((this.adFactory.SW_Desk_Add = _.add_desk_switch),
                        (this.adFactory.SW_Inters_Desk = _.add_inters_desk_switch),
                        (this.adFactory.Inters_Add_Num = _.inters_add_desk_num));
                var c = this.adConfig.time_switch_info;
                if (
                    void 0 !== c &&
                    null != c &&
                    ((this.adFactory.SW_Time_Switch = c.time_switch),
                        (this.adFactory.SW_Work_Days_Switch = c.work_days_switch),
                        (this.adFactory.Work_Days_Time = c.work_days_time),
                        (this.adFactory.SW_Day_Off_Switch = c.day_off_switch),
                        (this.adFactory.Day_Off_Time = c.day_off_time),
                        !t && c.time_switch)
                ) {
                    var d = "https://test2-1258404770.file.myqcloud.com/adInfo/date_info.json";
                    (d += "?t=" + Date.now()),
                        a.default.loadResJsonInfo(d, function (t) {
                            (e.adFactory.Day_Off_Info = t.json),
                                console.log("法定假日信息====", JSON.stringify(t.json));
                        });
                }
                var h = this.adConfig.area_switch_info;
                void 0 !== h &&
                    null != h &&
                    ((this.adFactory.SW_Area_Switch = h.area_switch),
                        (this.adFactory.Area_Open_GPS_Error = h.area_open_gps),
                        (this.adFactory.Area_Name_List = h.area_name_list));
                var u = this.adConfig.error_switch;
                void 0 !== u &&
                    null != u &&
                    ((this.adFactory.Error_Master_Switch = u.error_master_switch),
                        (this.adFactory.Error_Image_Switch = u.error_image_switch),
                        (this.adFactory.Error_Image_Num = u.error_image_num),
                        (this.adFactory.Error_Image_Prob = u.error_image_prob),
                        (this.adFactory.Error_Inters_Switch = u.error_inters_switch),
                        (this.adFactory.Error_Inters_Num = u.error_inters_num),
                        (this.adFactory.Error_Inters_Prob = u.error_inters_prob),
                        (this.adFactory.Error_Custom_Switch = u.error_custom_switch),
                        (this.adFactory.Error_Custom_Num = u.error_custom_num),
                        (this.adFactory.Error_Custom_Prob = u.error_custom_prob)),
                    n.default.platform == n.EPlatform.TikTok &&
                    ((this.adFactory.Tiktok_Share_Title = this.adConfig.ad_id_info.tiktok_title),
                        (this.adFactory.Tiktok_Group_ID = this.adConfig.ad_id_info.tiktok_group_id),
                        (this.adFactory.Tiktok_Name_Title = this.adConfig.game_name)),
                    this.adFactory.createAd();
            }),
            (e.prototype.getVideoFlag = function () {
                return this.adFactory.getVideoFlag();
            }),
            (e.prototype.showVideo = function (e, t) {
                this.adFactory.showVideo(e, t);
            }),
            (e.prototype.getIntersFlag = function () {
                return this.adFactory.getIntersFlag();
            }),
            (e.prototype.showInters = function () {
                this.adFactory.showInters();
            }),
            (e.prototype.showOppoCustom = function () {
                this.adFactory.showOppoCustom();
            }),
            (e.prototype.hideCustomAd = function () {
                this.adFactory.hideCustomAd();
            }),
            (e.prototype.showBanner = function () {
                this.adFactory.showBanner();
            }),
            (e.prototype.hideBanner = function () {
                this.adFactory.hideBanner();
            }),
            (e.prototype.getNativeImageAdFlag = function () {
                return this.adFactory.getNativeImageAdFlag();
            }),
            (e.prototype.getNativeIconAdFlag = function () {
                return this.adFactory.getNativeIconAdFlag();
            }),
            (e.prototype.getNativeImageAdInfo = function () {
                return this.adFactory.getNativeImageAdInfo();
            }),
            (e.prototype.getNativeIconAdInfo = function () {
                return this.adFactory.getNativeIconAdInfo();
            }),
            (e.prototype.reportNativeImageAdShow = function () {
                this.adFactory.reportNativeImageAdShow();
            }),
            (e.prototype.reportNativeIconAdShow = function () {
                this.adFactory.reportNativeIconAdShow();
            }),
            (e.prototype.nativeImageClick = function () {
                this.adFactory.nativeImageClick();
            }),
            (e.prototype.nativeIconClick = function () {
                this.adFactory.nativeIconClick();
            }),
            (e.prototype.getNativeCloseErr = function () {
                return this.adFactory.getNativeCloseErr();
            }),
            (e.prototype.getNavigateBoxBannerFlag = function () {
                return this.adFactory.getNavigateBoxBannerFlag();
            }),
            (e.prototype.showNavigateBoxBanner = function () {
                this.adFactory.showNavigateBoxBanner();
            }),
            (e.prototype.hideNavigateBoxBanner = function () {
                this.adFactory.hideNavigateBoxBanner();
            }),
            (e.prototype.getNavigateBoxPortalFlag = function () {
                return this.adFactory.getNavigateBoxPortalFlag();
            }),
            (e.prototype.showNavigateBoxPortal = function () {
                this.adFactory.showNavigateBoxPortal();
            }),
            (e.prototype.hideNavigateBoxPortal = function () {
                this.adFactory.hideNavigateBoxPortal();
            }),
            (e.prototype.hasAddDesktopFunc = function () {
                return this.adFactory.hasAddDesktopFunc();
            }),
            (e.prototype.getAddDesktopFlag = function (e) {
                this.adFactory.getAddDesktopFlag(e);
            }),
            (e.prototype.addDesktop = function (e) {
                this.adFactory.addDesktop(e);
            }),
            (e.prototype.setGroup = function (e) {
                this.adFactory.setGroup(e);
            }),
            (e.prototype.phoneVibrate = function (e) {
                this.adFactory.phoneVibrate(e);
            }),
            (e.prototype.getGameTestVersion = function () {
                return this.adFactory.getGameTestVersion();
            }),
            (e.prototype.getNativeImageErrorControl = function () {
                return this.adFactory.getNativeImageErrorControl();
            }),
            (e.prototype.getCustomErrorControl = function () {
                return this.adFactory.getCustomErrorControl();
            }),
            (e.prototype.getErrorControl = function () {
                return this.adFactory.getErrorControl();
            }),
            (e.prototype.StartRecorder = function (e) {
                this.adFactory.StartRecorder(e);
            }),
            (e.prototype.StopRecorder = function (e) {
                this.adFactory.StopRecorder(e);
            }),
            (e.prototype.ShareVideo = function (e, t) {
                this.adFactory.ShareVideo(e, t);
            }),
            (e.prototype.RecordClip = function (e, t) {
                this.adFactory.RecordClip(e, t);
            }),
            (e.prototype.PauseRecorder = function () {
                this.adFactory.PauseRecorder();
            }),
            (e.prototype.ResumeRecorder = function () {
                this.adFactory.ResumeRecorder();
            }),
            (e.prototype.jumpToMoreGamesCenter = function () {
                this.adFactory.jumpToMoreGamesCenter();
            }),
            (e.prototype.showMoreGamesBanner = function () {
                this.adFactory.showMoreGamesBanner();
            }),
            (e.prototype.hideMoreGamesBanner = function () {
                this.adFactory.hideMoreGamesBanner();
            }),
            (e.prototype.showFavoriteGuide = function (e, t, o) {
                this.adFactory.showFavoriteGuide(e, t, o);
            }),
            (e.prototype.getGroupFalg = function () {
                return this.adFactory.getGroupFalg();
            }),
            (e.prototype.TiktokJoinGroup = function () {
                this.adFactory.TiktokJoinGroup();
            }),
            e
        );
    })();
o.default = r;
